package cn.platform.service.impl;

import cn.platform.mapper.HarmonyActivityHomeworkMapper;
import cn.platform.response.AResponse;
import cn.platform.service.HarmonyActivityHomeworkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class HarmonyActivityHomeworkServiceImpl implements HarmonyActivityHomeworkService {
    @Autowired
    HarmonyActivityHomeworkMapper harmonyActivityHomeworkMapper;

    /**
     * 根据用户所在班级查询用户班级活动
     *
     * @param classId 班级id
     * @return AResponse res 班级活动
     * @author jyz
     */
    @Override
    public AResponse getActivityOrHomework(String classId, String type) {
        AResponse res = new AResponse();
        switch (type){
            case "activity":
                res.setData(harmonyActivityHomeworkMapper.getActivity(classId));
                break;
            case "homework":
                res.setData(harmonyActivityHomeworkMapper.getHomework(classId));
                break;
        }
        return res;
    }
}
